package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum AllocateShippingStatusEnum {
    /**
     * 1、待出库 2、已出库 3、已入库
     */
    ALLOCATE_SHIPPING_WAIT_OUT(1, "待出库"),
    ALLOCATE_SHIPPING_HAS_OUT(2, "已出库"),
    ALLOCATE_SHIPPING_HAS_IN(3, "已入库");

    private Integer id;
    private String name;

    AllocateShippingStatusEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        AllocateShippingStatusEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static AllocateShippingStatusEnum getById(Integer id) {
        for (AllocateShippingStatusEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

    public static void main(String args[]){
        System.out.println(AllocateShippingStatusEnum.getNameById(1));
    }
}
